package TestDemo;



import java.util.concurrent.atomic.AtomicBoolean;

public class Demo {
    public static void main(String[] args) {
        Thread thread  = new Thread(()-> {
            System.out.println("Hello thread线程");
            while() {

            }
        });
        System.out.println("Hello main线程");
    }
}
    /*public static void main6(String[] args) {
        Thread thread = new Thread(()-> {
            System.out.println("thread线程");
            while(true) {
                Thread.sleep(100);
            }
        });
    }
    public static void main4(String[] args) {
        Thread thread = new Thread(() -> {
            int flag = 3;
            while (flag > 0) {
                System.out.println("thread线程");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                flag--;
            }
        });
        thread.start();
    }
}*/
    /*public static void main2(String[] args) throws InterruptedException {
        Thread thread = new Thread(()-> {
            System.out.println("Hello thread");
        },"thread线程");
        thread.start();//启动thread引用内的线程
        thread.join();//等待thread线程执行完毕
        System.out.println(thread.getName());//输出thread的线程名
    }
    public static void main1(String[] args) throws InterruptedException {
        Thread thread = new Thread() {
            @Override
            public void run() {
                System.out.println("Hello thread");//run方法里面的线程
            }
        };
        thread.start();//启动线程
        thread.join();//等待线程
        System.out.println("Hello main");//main方法里面的线程
    }
}
*/